package org.linlinjava.litemall.admin.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.linlinjava.litemall.admin.beans.annotation.LogAnno;
import org.linlinjava.litemall.admin.controller.cashsettlement.AmountDifferenceDeletedBatchReqVO;
import org.linlinjava.litemall.admin.controller.cashsettlement.AmountDifferenceEnableBatchReqVO;
import org.linlinjava.litemall.admin.controller.cashsettlement.AmountDifferencePageReqVO;
import org.linlinjava.litemall.admin.controller.cashsettlement.AmountDifferenceReqVO;
import org.linlinjava.litemall.admin.dto.AdminCashDetailsDTO;
import org.linlinjava.litemall.admin.dto.AdminCashSettlementDTO;
import org.linlinjava.litemall.admin.service.AdminCashSettlementService;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.List;

@Api(tags = "POS日中、下班结算API")
@RestController
@RequestMapping("/admin/cash")
@RequiredArgsConstructor
public class AdminCashSettlementController extends ResponseUtil {

    private final AdminCashSettlementService cashSettlementService;

    @ApiOperation("交接管理-「交接管理列表」")
    @LogAnno
    @PostMapping("/cashSettlements")
    public Response cashSettlements(@RequestBody AdminCashSettlementDTO cashSettlementDTO){
        return cashSettlementService.cashSettlements(cashSettlementDTO);
    }

    @ApiOperation("交接管理-「交接管理总计」")
    @LogAnno
    @PostMapping("/summary")
    public Response summary(@RequestBody AdminCashSettlementDTO cashSettlementDTO){
        return cashSettlementService.summary(cashSettlementDTO);
    }

    @ApiOperation("交接管理-「交接管理列表-详情」")
    @LogAnno
    @PostMapping("/cashDetails")
    public Response cashDetails(@RequestBody AdminCashDetailsDTO cashDetailsDTO){
        return cashSettlementService.cashDetails(cashDetailsDTO);
    }

    @ApiOperation("新增金额差异记录")
    @PostMapping("/amountdiff/add")
    public Response addAmountDifference(@RequestBody AmountDifferenceReqVO reqVO) {
        return ResponseUtil.ok(cashSettlementService.amountDifferenceAdd(reqVO));
    }

    @ApiOperation("编辑金额差异记录")
    @PostMapping("/amountdiff/edit")
    public Response editAmountDifference(@RequestBody AmountDifferenceReqVO reqVO) {
        return ResponseUtil.ok(cashSettlementService.amountDifferenceEdit(reqVO));
    }

    @ApiOperation("查询金额差异记录列表")
    @GetMapping("/amountdiff/page")
    public Response listAmountDifference(AmountDifferencePageReqVO pageReqVO) {
        return ResponseUtil.okPage(cashSettlementService.amountDifferencePage(pageReqVO));
    }

    @ApiOperation("批量启用金额差异记录")
    @PostMapping("/amountdiff/enableBatch")
    public Response enableBatchAmountDifference(@RequestBody AmountDifferenceEnableBatchReqVO reqVO) {
        cashSettlementService.enableAmountDifferenceBatch(reqVO);
        return ResponseUtil.ok(true);
    }

    @ApiOperation("批量启用金额差异记录")
    @PostMapping("/amountdiff/deletedBatch")
    public Response deletedBatchAmountDifference(@RequestBody AmountDifferenceDeletedBatchReqVO reqVO) {
        cashSettlementService.deletedAmountDifferenceBatch(reqVO);
        return ResponseUtil.ok(true);
    }

}
